python: enable shared python lib; make this the norm
authorAlexandru Ardelean <[email protected]>
Sun, 19 Oct 2014 07:45:17 +0000 (10:45 +0300)
committerAlexandru Ardelean <[email protected]>
Sun, 19 Oct 2014 19:33:08 +0000 (22:33 +0300)
This will reduce the bloat when users will want to compile in their
Python C extensions.
There will be a initial bloat (several kb) if just Python
is installed, but that will be compensated when users will add more
C extensions.

During the build we also have to add Python's PKG_BUILD_DIR
so that the shared lib is found when compiling Python's
built-in C extensions.

Signed-off-by: Alexandru Ardelean <[email protected]>
lang/python/Makefile

index a2b2699e680f57d063a7e5f8ef3d437999765935..02f5a3b05fd67ed1f79fd250e3717663902c2abc 100644 (file)
@@ -140,7 +140,7 @@ MAKE_FLAGS:=\
        DESTDIR="$(PKG_INSTALL_DIR)" \
        CROSS_COMPILE=yes \
        CFLAGS="$(TARGET_CFLAGS) -DNDEBUG -fno-inline" \
-       LDFLAGS="$(TARGET_LDFLAGS)" \
+       LDFLAGS="$(TARGET_LDFLAGS) -L$(PKG_BUILD_DIR)" \
        LD="$(TARGET_CC)" \
        PGEN=pgen2
 
@@ -155,7 +155,7 @@ define Build/Configure
        $(CP) ./files/config.site $(PKG_BUILD_DIR)
        $(call Build/Configure/Default, \
                --sysconfdir=/etc \
-               --disable-shared \
+               --enable-shared \
                --without-cxx-main \
                --with-threads \
                --with-system-ffi="$(STAGING_DIR)/usr" \
@@ -176,7 +176,7 @@ define Build/InstallDev
                $(1)/usr/include/
        $(CP) \
                $(STAGING_DIR_HOST)/lib/python$(PYTHON_VERSION) \
-               $(PKG_BUILD_DIR)/libpython$(PYTHON_VERSION).a \
+               $(PKG_BUILD_DIR)/libpython$(PYTHON_VERSION).so* \
                $(1)/usr/lib/
        $(CP) \
                $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
@@ -389,6 +389,7 @@ endef
 define PyPackage/python/install
        $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python
        $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2
+       $(CP) $(PKG_BUILD_DIR)/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
 endef
 
 define PyPackage/python-doc/filespec